#include<bits/stdc++.h>
#define sd(n) scanf("%d",&n) 
#define sld(n) scanf("%lld",&n)
#define pd(n) printf("%d", (n))
#define pld(n) printf("%lld", n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
const int N = 2e5;
const int maxn = 1e6;
#define INF 0x7fffffff
typedef long long int ll;
using namespace std;
//----------------------------------------------------------------------------//
ll qmi(ll a, ll k, ll p)  // 快速幂模板
{
	ll res = 1 % p;
	while (k)
	{
		if (k & 1) res = (ll)res * a % p;
		a = (ll)a * a % p;
		k >>= 1;
	}
	return res;
}

ll C(ll a, ll b,ll p)  // 通过定理求组合数C(a, b)
{
	if (a < b) return 0;

	ll x = 1, y = 1;  // x是分子，y是分母
	for (int i = a, j = 1; j <= b; i--, j++)
	{
		x = (ll)x * i % p;
		y = (ll)y * j % p;
	}

	return x * (ll)qmi(y, p - 2, p) % p;
}

ll lucas(ll a, ll b, int p)
{
	if (a < p && b < p) return C(a, b, p);
	return (ll)C(a % p, b % p, p) * lucas(a / p, b / p, p) % p;
}


void solve()
{
	int n;
	sd(n);
	//aj-j=ai-i(转换一下公式)
	unordered_map<ll, int> cnt;//存ai-i
	for (int i = 1; i <= n; i++)
	{
		ll ai;
		sld(ai);
		cnt[ai - i]++;
	}
	ll ans = 0;
	for (auto kv : cnt)
	{
		if (kv.second >= 2)
			ans += lucas(kv.se, 2,INF);
	}
	cout << ans << '\n';
}

int main()
{
	int T;
	sd(T);
	while (T--)
	{
		solve();
	}
	return 0;
}